4️⃣ Event-Driven Architecture
💡 Best for: Systems requiring high availability and asynchronous processing (e.g., real-time updates, notifications).
✅ Key Concepts:
- Events trigger actions instead of direct service-to-service communication.
- Uses message brokers (Kafka, RabbitMQ, AWS SQS, Azure Service Bus).
📦 Example Workflow:
- User books a flight → Generates ReservationCreatedEvent.
- Event is published to Kafka/RabbitMQ.
- Payment Service listens for the event → Processes the payment.
- Notification Service listens for the event → Sends an email.
🔹 Why use it?
- Scales well with asynchronous processing.
- Decouples services, making them more resilient.
- Enables real-time processing (e.g., tracking flights, sending notifications).
🚨 Limitations:
- Eventual consistency (data synchronization across services can take time).
- Monitoring & debugging are harder compared to request-response systems.